<%@ page contentType="text/html;charset=utf-8" pageEncoding="UTF-8"%>
<%@ page
	import="java.io.*, java.sql.*, java.util.*, java.text.*, napal.*, util.*, napal.*"%>
<%@ page import="org.apache.ibatis.*"%>
<%@ page import="java.util.Date"%>
<%
	request.setCharacterEncoding("utf-8");
String aid = request.getParameter("aid");
int id = Integer.parseInt(aid);//기자재번호
Board b  =  RentalHome.getBoard(id);
%>
<%
String cmd = request.getParameter("cmd");
String select01 = request.getParameter("select01");
String dbsubject = request.getParameter("dbsubject");
String dbmemo = request.getParameter("dbmemo");

if ("수정".equals(cmd)) {
	if(select01.equals("말머리를 선택하세요.")){%>
	<script language=javascript>
				self.window.alert("말머리를 선택해주세요.");
				//location.href="BoardWrite.jsp";
			</script>
<% }else{
	int uid = Integer.parseInt(request.getParameter("aid"));
	 RentalHome.updateBoard(uid, select01, dbsubject, dbmemo); %>
			<script language=javascript>
				self.window.alert("입력한 글을 수정하였습니다.");
				location.href="BoardList.jsp";
			</script>
<% } } %>


<%@ include file="./Header.jsp"%>
			</td>
		</TR>
		<TR HEIGHT="100">
		<td>
		


<form onsubmit="return confirm('해당 게시글을 수정하시겠습니까?'); ">
<p align="center">
<table width=80% border=1 cellspacing=0 cellpadding=5 class="table">

		<tr>
			<td width=20%><b><p align="right">이름</p></b></td>
			<td width=80%><% String man = b.get글쓴직원ID(); 
			String use = b.get글쓴사용자ID();
			if(man!=null){ %> <%=b.get이름() %>

			
			<%}
			else { %> <%= b.get이름() %>
			
			<%}
			%></td>
		</tr>
					<tr><td><b><p align="right">말머리</p></b></td>
			<td><select name="select01">
		<option>말머리를 선택하세요.</option>
		
		
		<% if(b.get말머리().equals("공지사항")){ %>
			<%if((String)session.getAttribute("ManagerID")!=null){ %><OPTION VALUE="공지사항" selected>공지사항</OPTION><% }%>
			<OPTION VALUE="질문">질문</option>
			<% }
		else if(b.get말머리().equals("질문")){ %>
		<%if((String)session.getAttribute("ManagerID")!=null){ %><OPTION VALUE="공지사항">공지사항</OPTION><% }%>
			<OPTION VALUE="질문" selected>질문</option>
			<% } 
			else { %>
		<%if((String)session.getAttribute("ManagerID")!=null){ %><OPTION VALUE="공지사항">공지사항</OPTION><% }%>
			<OPTION VALUE="질문">질문</option>
			<% } %>
		</SELECT>
			</td>
		</tr>
			<tr><td><b><p align="right">제목</p></b></td>
			<td><input type=text class="input-block-level" name=dbsubject size=200  maxlength=50 value="<%=b.get제목() %>"></td>
		</tr>

			<tr><td><b><p align="right">내용</p></b></td>
			<td><textarea name=dbmemo cols=50 rows=20 class="input-block-level"><%= b.get내용() %></textarea></td>
		</tr>

</table>
		
		</p>
<center>
				<input
			name="cmd" class="btn btn-inverse" type=submit value="수정">
				<input type=button value="목록"
					OnClick="window.location='BoardList.jsp'" class="btn btn-inverse">
			</center>
					<form method=post>
		<input type=hidden value="<%= b.get게시글번호() %>" name="aid"></form>
						</form>
		
		
		
		
		

	</TD>
</TR>



<TR HEIGHT="100">
<TD><%@ include file="./bottom.jsp"%></TD> 
</TR>
</TABLE>
</body>
</html>